package cn.virens.cmpt.rabbit.packet.reply;

import java.io.Serializable;
import java.nio.charset.Charset;

import com.alibaba.fastjson.JSON;

import cn.hutool.core.util.StrUtil;

public class RabbitPacketReply implements Serializable {
	private static final long serialVersionUID = 6621700865431752357L;
	private String rabbitRoutingKey;
	private String rabbitExchange;

	private String message;
	private String code;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getRabbitExchange() {
		return rabbitExchange;
	}

	public void setRabbitExchange(String rabbitExchange) {
		this.rabbitExchange = rabbitExchange;
	}

	public String getRabbitRoutingKey() {
		return rabbitRoutingKey;
	}

	public void setRabbitRoutingKey(String rabbitRoutingKey) {
		this.rabbitRoutingKey = rabbitRoutingKey;
	}

	/** 指令包序列化 */
	public byte[] serialize(Charset charset) {
		return StrUtil.bytes(toString(), charset);
	}

	@Override
	public String toString() {
		return JSON.toJSONString(this);
	}
}
